<script>

import {attachDownload} from '@/api/busi_resume';

export default {
  beforeCreate() {
  },
  created(){
    const { query } = this.$route;
    let fileName = '未知文件';
    if(query.file_name){
      fileName = query.file_name;
    }
    attachDownload(query).then( response => {
      const url = window.URL.createObjectURL(new Blob([response.data], {type: 'application/octet-stream'}));
      const link = document.createElement('a');
      link.href = url;
      link.setAttribute('download', fileName); //or any other extension
      document.body.appendChild(link);
      link.click();
      setTimeout(function(){
        window.close();
      }, 500);
    });
  },
  render: function() {
  }
};
</script>